#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 2; i <= n / i; i++) {
		if (n % i == 0) {
			int sum = 0;
			while (n % i == 0) {
				sum++;
				n /= i;
			}
			cout << i << " " << sum << " " << endl;
		}
	}
	if (n > 1) {
		cout << n << " " << 1 << endl;
	}
	return 0;
}